package com.sxz.sbs.module.performance.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sxz.sbs.R;
import com.sxz.sbs.module.performance.mode.FieldRankBean;

import java.util.List;

/**
 * 案场榜适配器
 */

public class FieldRankAdapter extends BaseQuickAdapter<FieldRankBean.ListBean,BaseViewHolder>{
    public FieldRankAdapter(@Nullable List<FieldRankBean.ListBean> data) {
        super(R.layout.item_field_rank_layout,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FieldRankBean.ListBean item) {
        helper.setText(R.id.tv_field_rank_id,item.getTemprownumber()+"");
        if (helper.getAdapterPosition() <= 2) {
            helper.setTextColor(R.id.tv_field_rank_id, Color.parseColor("#ff9d00"));
        } else {
            helper.setTextColor(R.id.tv_field_rank_id, Color.parseColor("#666666"));
        }
        helper.setText(R.id.tv_field_rank_name,item.getCity());
        helper.setText(R.id.tv_field_rank_house,item.getParkingName());
        helper.setText(R.id.tv_field_rank_field_number,item.getCountNum()+"个");
        helper.setText(R.id.tv_field_rank_praise_number,item.getPraiseNum()+"");
        if (item.getIsParise() == 0) {
            helper.setImageResource(R.id.iv_field_rank_praise,R.drawable.ic_thumb);
        } else {
            helper.setImageResource(R.id.iv_field_rank_praise,R.drawable.ic_thumb_blue);
        }
        helper.addOnClickListener(R.id.iv_field_rank_praise);
    }
}
